{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "76941960-35f6-4cb3-8487-9be435ff4337",
   "metadata": {},
   "outputs": [],
   "source": [
    "import ipyturtle3 as turtle\n",
    "from ipyturtle3 import hold_canvas\n",
    "myCanvas=turtle.Canvas(width=500,height=250)\n",
    "display(myCanvas)\n",
    "myTS=turtle.TurtleScreen(myCanvas)\n",
    "myTS.clear()\n",
    "myTS.bgcolor(\"lightgreen\")\n",
    "bob=turtle.Turtle(myTS)\n",
    "jess=turtle.Turtle(myTS,isHolonomic=True)\n",
    "jess.shape(\"square\")\n",
    "bob.shape(\"turtle\")\n",
    "\n",
    "myTS.delay(200)\n",
    "# Usual turtle Non-holonomic example\n",
    "bob.forward(50)\n",
    "bob.left(90)\n",
    "bob.forward(50)\n",
    "bob.left(90)\n",
    "bob.forward(50)\n",
    "bob.left(90)\n",
    "bob.forward(50)\n",
    "\n",
    "\n",
    "#Holonomic\n",
    "jess.moveleft(200)\n",
    "jess.moveup(100)\n",
    "jess.moveright(100)\n",
    "jess.movedown(100)\n",
    "jess.turnright(45)\n",
    "jess.turn(-45)\n",
    "jess.distance_at_angle(50,45)\n",
    "\n",
    "myTS.clear()\n",
    "\n",
    "# Rainbow benzene\n",
    "colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow']\n",
    "t = turtle.Turtle(myTS)\n",
    "myTS.bgcolor('black')\n",
    "for x in range(50):\n",
    "    with(hold_canvas(myCanvas)):\n",
    "        t.pencolor(colors[x%6])\n",
    "        t.width(x//100 + 1)\n",
    "        t.forward(x)\n",
    "        t.left(59)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
